<?php include'setSession.php';?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Login</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="app.css" rel="stylesheet">
</head>
<body>
    <div class="container-fluid">
        <img class="img-responsive center-block" src="UoL_logo.png" alt="Logo" width="200">
    </div>
    <div class="container">
        <div class="row">
            <h4 class="text-center">Welcome to the Department of Computer Science</h4>
            <div class="col-xs-6 col-md-4 col-center-block">
                <p>Please enter your Managed Windows Service(MWS)
                username and password to log in.</p>
                <form method="post" action="logintest.php" role="form">
                    <div class="form-group">
                        <label>Username: </label>
                        


                        <?php
                            if(@$_COOKIE['username']==""){
                                echo"<input name='username' type='text' class='form-control' placeholder='Username'>";
                            }
                            else{
                                $username=@$_COOKIE['username'];
                                echo"<input name='username' type='text' class='form-control' value=".$username.">";
                            }
                            if(@$_COOKIE['isUsername']==1){
                                $aaa="*The username or password you entered is incorrect. Please try again.";
                                echo"<div class='text-danger'>".$aaa."</div>";
                            }
                        ?>
                        
                    </div>
                    <div class="form-group">
                        <label>Password: </label>
                        <input name="password" type="password" class="form-control" placeholder="Password">
                        
                        <!--php-->
                        <?php
                            if(@$_COOKIE['isPassword']==2){
                                $aaa="*Enter a username and password.";
                                echo"<div class='text-danger'>".$aaa."</div>";
                            }
                            if(@$_COOKIE['isPassword']==1){
                                $aaa="*The username or password you entered is incorrect. Please try again.";
                                echo"<div class='text-danger'>".$aaa."</div>";
                            }
                            
                        ?>
                        <!--php-->
                    </div>
                        <button type="submit" class="btn btn-default">Login</button>
                </form>

            </div>
        </div>
    </div>
    <script src="jquery-3.0.0.min.js"></script>
    <script src="bootstrap.min.js"></script>
</body>
</html>